package com.patni.mainface;

import java.awt.Color;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.Area;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.patni.body.Body;
import com.patni.mainface.modify.UpHideFrame;
import com.sun.awt.AWTUtilities;


public class testFrame extends ResizeFrame{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Body mainlabel;
	public testFrame(){
		this.setTitle("test");
		this.setBounds(200, 200, 250,600);
		
		this.setUndecorated(true);
		 AWTUtilities.setWindowShape(this,getImageShape(250,600));        
		 AWTUtilities.setWindowOpacity(this, 0.99f);
		    
		    this.setLocationRelativeTo(null);
		    
		    JPanel pan1=new JPanel();
			pan1.setBackground(Color.black);
			pan1.setBounds(0, 0, 15, 15);
			this.add(pan1);
		    
			
			mainlabel=new Body(250,400);
			
			mainlabel.setLocation(0, 100);
			this.add(mainlabel);
			this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			mainlabel.changeSize(250,400);
			
		   JPanel pan= (JPanel)getContentPane();
		   pan.setOpaque(true);
		   pan.setLayout(null);
		   JLabel jl=new JLabel();
		   jl.setIcon(new ImageIcon("sky.jpg"));
		   jl.setBounds(0, 0,800,700);
		   
		  
		   pan.add(jl,new Integer(Integer.MIN_VALUE));
		   
		   
		    
	}
	public Shape	getImageShape(int width,int height){
		Area shape=new Area();
		
		for(int i=4;i>=1;i--){
			shape.add(new Area(new Rectangle(i,4-i,width-2*i,1)));
		}
		shape.add(new Area(new Rectangle(0,4,width,height-4*2)));
		
		for(int i=1;i<=4;i++){
		shape.add(new Area(new Rectangle(i,height-5+i,width-2*i,1)));
		}
		
		return shape;
	}
	public static void main(String[] args){
		testFrame mainFace=new testFrame();
		mainFace.addMouseListener(new UpHideFrame(mainFace));
		mainFace.setVisible(true);
	}
}
